<template>
  <Drawer
    title="病案首页"
    width="55%"
    placement="left"
    :scrollable="true"
    :closable="false"
    v-model="showLeft"
    :mask="false"
    :draggable="true"
    @on-close="closeLeft"
  >
    <div style="width: 100%; height: 2250px; border: 2px solid; padding: 10px">
      <!-- <Scroll height="850"> -->
      <Row>
        <Col span="2" class="ivu-text-right">医疗机构：</Col>
        <Col class="hx" span="6">{{ form.head?.hospitalName }}</Col>
        <Col span="4" class="ivu-text-right">（组织机构代码：</Col>
        <Col class="hx" span="4">{{ form.head?.hospitalCode }} </Col>
        <Col span="1">）</Col>
        <Col span="3">医疗付费方式：</Col>
        <Col span="4" class="underline">{{ ylfkfs }}</Col>
      </Row>
      <Divider>
        <Title :level="4">住院病案首页</Title>
      </Divider>
      <Row>
        <Col span="2" class="ivu-text-right">健康卡号：</Col>
        <Col span="8" class="hx">{{ form.head?.cardNo }} </Col>
        <Col span="1" class="ivu-text-right" push="1">第</Col>
        <Col span="1" class="hx" push="1">{{ form.diagInfo?.inCount }} </Col>
        <Col span="5" push="1">次住院</Col>
        <Col span="2" class="ivu-text-right">病案号：</Col>
        <Col span="5" class="hx">{{ form.head?.number }} </Col>
      </Row>
      <Row>
        <Col span="2" class="ivu-text-right">姓名：</Col>
        <Col span="3" class="hx">{{ form.basicInfo?.realName }} </Col>
        <Col span="2" class="ivu-text-right">性别：</Col>
        <Col span="3" class="hx">{{ form.basicInfo?.sex === '1' ? '男' : '女' }} </Col>
        <Col span="2" class="ivu-text-right">出生日期：</Col>
        <Col span="4" class="hx"> {{ form?.basicInfo?.year }} </Col>
        <Col span="2" class="ivu-text-right">年龄：</Col>
        <Col span="2" class="hx">{{ form?.basicInfo?.age }}</Col>
        <Col span="2" class="ivu-text-right">国籍：</Col>
        <Col span="2" class="hx">{{ gjInfoEnum[form?.basicInfo?.coutry] }} </Col>
      </Row>
      <Row>
        <Col span="5" class="ivu-text-right">（年龄不足1周岁的）年龄： </Col>
        <Col span="2" class="hx">{{ form?.basicInfo?.age_New }} </Col>
        <Col span="1">月</Col>
        <Col span="4" class="ivu-text-right">新生儿出生体重： </Col>
        <Col span="3" class="hx">{{ form?.basicInfo?.newBornOutWeight }} </Col>
        <Col span="1">克</Col>
        <Col span="4" class="ivu-text-right">新生儿入院体重：</Col>
        <Col span="3" class="hx">{{ form?.basicInfo?.newBornInWeight }} </Col>
        <Col span="1">克</Col>
      </Row>
      <Row>
        <Col span="2" class="ivu-text-right">出生地：</Col>
        <Col span="13" class="hx">{{ form.basicInfo?.bornAddr }} </Col>
        <Col span="2" class="ivu-text-right">籍贯：</Col>
        <Col span="3" class="hx">{{ form.basicInfo?.origin }}</Col>
        <Col span="2" class="ivu-text-right">民族：</Col>
        <Col span="2" class="hx">{{ mzInfoEnum[form?.basicInfo?.nation] }} </Col>
      </Row>
      <Row>
        <Col span="2" class="ivu-text-right">身份证号：</Col>
        <Col span="13" class="hx">{{ form.basicInfo?.CertNo }} </Col>
        <Col span="2" class="ivu-text-right">职业：</Col>
        <Col span="3" class="hx">{{ zyEnum[form?.basicInfo?.jobType] }} </Col>
        <Col span="2" class="ivu-text-right">婚姻：</Col>
        <Col span="2" class="hx">{{ form.basicInfo?.marriage }} </Col>
      </Row>
      <Row>
        <Col span="2" class="ivu-text-right">现住址：</Col>
        <Col span="13" class="hx">{{ form.basicInfo?.homeAddress }} </Col>
        <Col span="2" class="ivu-text-right">电话：</Col>
        <Col span="3" class="hx">{{ form.basicInfo?.dh }}</Col>
        <Col span="2" class="ivu-text-right">邮编：</Col>
        <Col span="2" class="hx">{{ form.basicInfo?.homePostCode }}</Col>
      </Row>
      <Row>
        <Col span="2" class="ivu-text-right">户口地址：</Col>
        <Col span="18" class="hx">{{ form.basicInfo?.postCode }} </Col>
        <Col span="2" class="ivu-text-right">邮编：</Col>
        <Col span="2" class="hx">{{ form.basicInfo?.yb2 }} </Col>
      </Row>
      <Row>
        <Col span="2" class="ivu-text-right">工作单位：</Col>
        <Col span="13" class="hx">{{ form.basicInfo?.jobAddress }} </Col>
        <Col span="2" class="ivu-text-right">电话：</Col>
        <Col span="3" class="hx">{{ form.basicInfo?.jobPhone }} </Col>
        <Col span="2" class="ivu-text-right">邮编：</Col>
        <Col span="2" class="hx">{{ form.basicInfo?.jobPostCode }} </Col>
      </Row>
      <Row>
        <Col span="2" class="ivu-text-right">联系人：</Col>
        <Col span="4" class="hx">{{ form.basicInfo?.contactName }} </Col>
        <Col span="2" class="ivu-text-right">关系：</Col>
        <Col span="2" class="hx">{{ form.basicInfo?.contactType }} </Col>
        <Col span="2" class="ivu-text-right">地址：</Col>
        <Col span="7" class="hx">{{ form.basicInfo?.contactAddress }} </Col>
        <Col span="2" class="ivu-text-right">电话：</Col>
        <Col span="3" class="hx">{{ form.basicInfo?.contactPhone }} </Col>
      </Row>
      <Row>
        <Col span="2" class="ivu-text-right">入院途径：</Col>
        <Col span="22" class="hx">{{ Enum2[form?.diagInfo?.way] || '' }} </Col>
      </Row>
      <Row>
        <Col span="2" class="ivu-text-right">入院时间：</Col>
        <Col span="5" class="hx">
          {{ $timeFilter(form.diagInfo?.inTime, 'format5') }}年{{
            $timeFilter(form.diagInfo?.inTime, 'format6')
          }}月 {{ $timeFilter(form.diagInfo?.inTime, 'format7') }}日</Col
        >
        <Col span="1"> </Col>
        <Col span="2">入院科别：</Col>
        <Col span="4" class="hx">{{ kbInfoEnum[form.diagInfo?.inCategory] }} </Col>
        <Col span="2" class="ivu-text-right">病房：</Col>
        <Col span="2" class="hx">{{ form.diagInfo?.inRoom }} </Col>
        <Col span="2" class="ivu-text-right">转科科别：</Col>
        <Col span="4" class="hx">{{ kbInfoEnum[form.diagInfo?.turnCategory] }} </Col>
      </Row>
      <Row>
        <Col span="2" class="ivu-text-right">出院时间：</Col>
        <Col span="5" class="hx">
          {{ $timeFilter(form.diagInfo?.outTime, 'format5') }}年{{
            $timeFilter(form.diagInfo?.outTime, 'format6')
          }}月 {{ $timeFilter(form.diagInfo?.outTime, 'format7') }}日</Col
        >
        <Col span="1"> </Col>
        <Col span="2">出院科别：</Col>
        <Col span="4" class="hx">{{ kbInfoEnum[form.diagInfo?.outCategory] }}</Col>
        <Col span="2" class="ivu-text-right">病房：</Col>
        <Col span="2" class="hx">{{ form.diagInfo?.outRoom }} </Col>
        <Col span="2" class="ivu-text-right">实际住院：</Col>
        <Col span="3" class="hx">{{ form.diagInfo?.inDays }} </Col>
        <Col span="1">天</Col>
      </Row>
      <Row>
        <Col span="4" class="ivu-text-right">门（急）诊诊断：</Col>
        <Col span="8" class="hx">{{ form.diagInfo?.in_WM_Diag }}</Col>
        <Col span="4" class="ivu-text-right">疾病编码：</Col>
        <Col span="8" class="hx">{{ form.diagInfo?.in_WM_Code }}</Col>
      </Row>
      <Divider />
      <Row>
        <Col span="24">
          <table border="1" cellspacing="0" cellpadding="10" style="width: 100%; text-align: left">
            <thead>
              <tr>
                <th style="width: 16.66%; text-align: center; padding: 8px 0">出院诊断</th>
                <th style="width: 16.66%; text-align: center; padding: 8px 0">疾病编码</th>
                <th style="width: 16.66%; text-align: center; padding: 8px 0">入院病情</th>
                <th style="width: 16.66%; text-align: center; padding: 8px 0">出院诊断</th>
                <th style="width: 16.66%; text-align: center; padding: 8px 0">疾病编码</th>
                <th style="width: 16.66%; text-align: center; padding: 8px 0">入院病情</th>
              </tr>
            </thead>
            <tbody>
              <tr>
                <td style="background-color: #f44336; padding: 8px 0">
                  主要诊断：{{ mainDiagnosis.name }}
                </td>
                <td style="background-color: #f44336; padding: 8px 0">{{ mainDiagnosis.code }}</td>
                <td style="background-color: #ff8a65; padding: 8px 0">{{ mainDiagnosis.desc }}</td>
                <td style="padding: 8px 0">其他诊断8：{{ otherRight[0]?.name }}</td>
                <td style="padding: 8px 0">{{ otherRight[0]?.code }}</td>
                <td style="padding: 8px 0">{{ otherRight[0]?.desc }}</td>
              </tr>

              <tr v-for="i in 7" :key="i">
                <td style="padding: 8px 0">其他诊断{{ i }}：{{ otherLeft[i - 1]?.name }}</td>
                <td style="padding: 8px 0">{{ otherLeft[i - 1]?.code }}</td>
                <td style="padding: 8px 0">{{ otherLeft[i - 1]?.desc }}</td>
                <td style="padding: 8px 0">其他诊断{{ i + 8 }}：{{ otherRight[i]?.name }}</td>
                <td style="padding: 8px 0">{{ otherRight[i]?.code }}</td>
                <td style="padding: 8px 0">{{ otherRight[i]?.desc }}</td>
              </tr>
            </tbody>
          </table>
        </Col>
      </Row>
      <Row>
        <Col span="5" class="ivu-text-right">入院病情：</Col>
        <Col span="19">1. 有, 2. 临床未确定, 3. 情况不明, 4. 无</Col>
      </Row>
      <Row>
        <Col span="5" class="ivu-text-right">损伤、中毒的外部原因：</Col>
        <Col span="7" class="hx">{{ form.diagInfo?.poison }} </Col>
        <Col span="4" class="ivu-text-right">疾病编码：</Col>
        <Col span="8" class="hx">{{ form.diagInfo?.poisonCode }}</Col>
      </Row>
      <Row>
        <Col span="5" class="ivu-text-right">病理诊断：</Col>
        <Col span="19" class="hx">{{ form.diagInfo?.pathology }} </Col>
      </Row>
      <Row>
        <Col span="5" class="ivu-text-right">疾病编码：</Col>
        <Col span="7" class="hx">{{ form.diagInfo?.pathologyCode }} </Col>
        <Col span="4" class="ivu-text-right">病理号：</Col>
        <Col span="8" class="hx">{{ form.diagInfo?.pathologyNo }}</Col>
      </Row>
      <Row> </Row>
      <Row>
        <Col span="5" class="ivu-text-right">药物过敏：</Col>
        <Col span="1" class="hx">{{ form.diagInfo?.react === '1' ? '无' : '有' }}</Col>
        <Col span="2" class="ivu-text-right">过敏药物：</Col>
        <Col span="4" class="hx">{{ form.diagInfo?.reactName }}</Col>
        <Col span="3" class="ivu-text-right">死亡患者尸检：</Col>
        <Col span="1" class="hx">{{ form.diagInfo?.deathCheck == 1 ? '是' : '否' }}</Col>
        <Col span="2" class="ivu-text-right">血型：</Col>
        <Col span="2" class="hx">{{ bloodType }}</Col>
        <Col span="2" class="ivu-text-right">RH：</Col>
        <Col span="2" class="hx">{{ rh }}</Col>
      </Row>
      <Divider />
      <Row>
        <Col span="2" class="ivu-text-right">科主任：</Col>
        <Col span="2" class="hx">{{ form.personInfo?.kzr }}</Col>
        <Col span="6" class="ivu-text-right">主任（副主任）医师：</Col>
        <Col span="2" class="hx">{{ form.personInfo?.zrys }}</Col>
        <Col span="4" class="ivu-text-right">主治医师：</Col>
        <Col span="2" class="hx">{{ form.personInfo?.dcName }}</Col>
        <Col span="4" class="ivu-text-right">住院医师：</Col>
        <Col span="2" class="hx">{{ form.personInfo?.zyys }}</Col>
      </Row>
      <Row>
        <Col span="2" class="ivu-text-right">责任护士：</Col>
        <Col span="2" class="hx">{{ form.personInfo?.nurseName }}</Col>
        <Col span="6" class="ivu-text-right">进修医师：</Col>
        <Col span="2" class="hx">{{ form.personInfo?.jxys }}</Col>
        <Col span="4" class="ivu-text-right">实习医师：</Col>
        <Col span="2" class="hx">{{ form.personInfo?.sxys }}</Col>
        <Col span="4" class="ivu-text-right">编码员：</Col>
        <Col span="2" class="hx">{{ form.personInfo?.bmy }}</Col>
      </Row>
      <Row>
        <Col span="2" class="ivu-text-right">病案质量：</Col>
        <Col span="2" class="hx">{{ bazl }}</Col>
        <Col span="6" class="ivu-text-right">质控医师：</Col>
        <Col span="2" class="hx">{{ form.personInfo?.zkys }}</Col>
        <Col span="4" class="ivu-text-right">质控护士：</Col>
        <Col span="2" class="hx">{{ form.personInfo?.zkhs }}</Col>
        <Col span="2" push="1">质控日期：</Col>
        <Col span="3" class="hx" push="1">{{ form.diagInfo?.zkrq }}</Col>
      </Row>
      <Row>
        <Col span="24">
          <Table
            :columns="columns2"
            :data="form.diagInfo.operItems"
            stripe
            border
            draggable
            size="small"
          ></Table>
        </Col>
      </Row>
      <Divider />
      <Row>
        <Col span="6" class="ivu-text-right">离院方式：</Col>
        <Col span="18" class="hx">{{ outWay }} </Col>
      </Row>
      <Row>
        <Col span="6" class="ivu-text-right">是否有出院31天内再住院计划：</Col>
        <Col span="18" class="hx">{{ outAgainType }} </Col>
      </Row>
      <Row>
        <Col span="6" class="ivu-text-right">颅脑损伤患者昏迷时间：</Col>
        <Col span="2" class="ivu-text-right">入院前</Col>
        <Col span="1" class="hx">{{ form.diagInfo?.ryQ_T }} </Col>
        <Col span="1">天</Col>
        <Col span="1" class="hx">{{ form.diagInfo?.ryQ_XS }} </Col>
        <Col span="1">小时</Col>
        <Col span="1" class="hx">{{ form.diagInfo?.ryQ_FZ }} </Col>
        <Col span="1">分钟</Col>
        <Col span="4" class="ivu-text-right">入院后</Col>
        <Col span="1" class="hx">{{ form.diagInfo?.ryH_T }} </Col>
        <Col span="1">天</Col>
        <Col span="1" class="hx">{{ form.diagInfo?.ryH_XS }} </Col>
        <Col span="1">小时</Col>
        <Col span="1" class="hx">{{ form.diagInfo?.ryH_FZ }} </Col>
        <Col span="1">分钟</Col>
      </Row>
      <Row>
        <Col span="6" class="ivu-text-right">住院费用（元）：总费用：</Col>
        <Col span="4" class="hx">{{ form.diagInfo?.total }} </Col>
        <Col span="6" class="ivu-text-right">(自付金额：</Col>
        <Col span="4" class="hx">{{ form.diagInfo?.zfje }} </Col>
        <Col span="1">）</Col>
      </Row>
      <Row>
        <Col span="6" class="ivu-text-right">1.综合医疗服务类：</Col>
        <Col span="5" class="ivu-text-right">（1）一般医疗服务费：</Col>
        <Col span="4" class="hx">{{ form.diagInfo?.ybylfwf }}</Col>
        <Col span="5" class="ivu-text-right">（2）一般治疗操作费：</Col>
        <Col span="4" class="hx">{{ form.diagInfo?.ybzlczf }} </Col>
      </Row>
      <Row>
        <Col span="8"> </Col>
        <Col span="3" class="ivu-text-right">（3）护理费：</Col>
        <Col span="4" class="hx">{{ form.diagInfo?.hlf }} </Col>
        <Col span="5" class="ivu-text-right">（4）其他费用：</Col>
        <Col span="4" class="hx">{{ form.diagInfo?.qtfy }} </Col>
      </Row>
      <Row>
        <Col span="6" class="ivu-text-right">2.诊断类：</Col>
        <Col span="5" class="ivu-text-right">（5）病理诊断费：</Col>
        <Col span="4" class="hx">{{ form.diagInfo?.blzdf }}</Col>
        <Col span="5" class="ivu-text-right">（6）实验室诊断费：</Col>
        <Col span="4" class="hx">{{ form.diagInfo?.syszdf }} </Col>
      </Row>
      <Row>
        <Col span="7"> </Col>
        <Col span="4" class="ivu-text-right">（7）影像学诊断费：</Col>
        <Col span="4" class="hx">{{ form.diagInfo?.yxxzdf }} </Col>
        <Col span="5" class="ivu-text-right">（8）临床诊断项目费：</Col>
        <Col span="4" class="hx">{{ form.diagInfo?.lczdxmf }} </Col>
      </Row>
      <Row>
        <Col span="6" class="ivu-text-right">3.治疗类：</Col>
        <Col span="5" class="ivu-text-right">（9）非手术治疗项目费：</Col>
        <Col span="4" class="hx">{{ form.diagInfo?.fsszlxmf }}</Col>
        <Col span="5" class="ivu-text-right" pull="1">（临床物理治疗费：</Col>
        <Col span="3" class="hx" pull="1">{{ form.diagInfo?.lcwlzlf }} </Col>
        <Col span="1" pull="1"> ）</Col>
      </Row>
      <Row>
        <Col span="3"> </Col>
        <Col span="6" class="ivu-text-right">（10）手术治疗费：</Col>
        <Col span="3" class="hx">{{ form.diagInfo?.sszlf }} </Col>
        <Col span="3" class="ivu-text-right" pull="1">（麻醉费：</Col>
        <Col span="3" class="hx" pull="1">{{ form.diagInfo?.mzf }} </Col>
        <Col span="2" class="ivu-text-right" pull="1">手术费：</Col>
        <Col span="3" class="hx" pull="1">{{ form.diagInfo?.ssf }} </Col>
        <Col span="1" pull="1"> ）</Col>
      </Row>
      <Row>
        <Col span="6" class="ivu-text-right">4.康复类：</Col>
        <Col span="5" class="ivu-text-right">（11）康复费：</Col>
        <Col span="13" class="hx">{{ form.diagInfo?.kff }} </Col>
      </Row>
      <Row>
        <Col span="6" class="ivu-text-right">5.中医类：</Col>
        <Col span="5" class="ivu-text-right">（12）中医治疗费：</Col>
        <Col span="13" class="hx">{{ form.diagInfo?.zyzlf }} </Col>
      </Row>
      <Row>
        <Col span="6" class="ivu-text-right">6.西药类：</Col>
        <Col span="5" class="ivu-text-right">（13）西药费：</Col>
        <Col span="4" class="hx">{{ form.diagInfo?.xyf }} </Col>
        <Col span="4" class="ivu-text-right" pull="1">（抗菌药物费用：</Col>
        <Col span="4" class="hx" pull="1">{{ form.diagInfo?.kjywf }} </Col>
        <Col span="1" pull="1"> ）</Col>
      </Row>
      <Row>
        <Col span="6" class="ivu-text-right">7.中药类：</Col>
        <Col span="5" class="ivu-text-right">（14）中成药费：</Col>
        <Col span="4" class="hx">{{ form.diagInfo?.zcyf }} </Col>
        <Col span="5" class="ivu-text-right">（15）中草药费：</Col>
        <Col span="4" class="hx">{{ form.diagInfo?.zcyf1 }} </Col>
      </Row>
      <Row>
        <Col span="6" class="ivu-text-right">8.血液和血液制品类：</Col>
        <Col span="5" class="ivu-text-right">（16）血费：</Col>
        <Col span="4" class="hx">{{ form.diagInfo?.xf }} </Col>
        <Col span="5" class="ivu-text-right">（17）白蛋白类制品费：</Col>
        <Col span="4" class="hx">{{ form.diagInfo?.bdblzpf }} </Col>
      </Row>
      <Row>
        <Col span="6" class="ivu-text-right"> </Col>
        <Col span="5" class="ivu-text-right">（18）球蛋白类制品费：</Col>
        <Col span="4" class="hx">{{ form.diagInfo?.qdblzpf }} </Col>
        <Col span="5" class="ivu-text-right">（19）凝血因子类制品费：</Col>
        <Col span="4" class="hx">{{ form.diagInfo?.nxyzlzpf }} </Col>
      </Row>
      <Row>
        <Col span="6" class="ivu-text-right"> </Col>
        <Col span="5" class="ivu-text-right">（20）细胞因子类制品费：</Col>
        <Col span="13" class="hx">{{ form.diagInfo?.xbyzlzpf }} </Col>
      </Row>
      <Row>
        <Col span="6" class="ivu-text-right">9.耗材类：</Col>
        <Col span="6" class="ivu-text-right">（21）检查用一次性医用材料费：</Col>
        <Col span="3" class="hx">{{ form.diagInfo?.jcclf }} </Col>
        <Col span="6" class="ivu-text-right">（22）治疗用一次性医用材料费：</Col>
        <Col span="3" class="hx">{{ form.diagInfo?.zlclf }} </Col>
      </Row>
      <Row>
        <Col span="6" class="ivu-text-right"> </Col>
        <Col span="6" class="ivu-text-right">（23）手术用一次性医用材料费：</Col>
        <Col span="12" class="hx">{{ form.diagInfo?.ssclf }} </Col>
      </Row>
      <Row>
        <Col span="6" class="ivu-text-right">10.其他类：</Col>
        <Col span="3" class="ivu-text-right">（24）其他费：</Col>
        <Col span="15" class="hx">{{ form.diagInfo?.qtf }} </Col>
      </Row>
      <Divider />
      <Row>
        <Col span="2" class="ivu-text-right">说明：</Col>
        <Col span="22"
          >（一）医疗付费方式：1.城镇职工基本医疗保险 2.城镇居民基本医疗保险 3.新型农村合作医疗
        </Col>
      </Row>
      <Row>
        <Col span="22" push="6"
          >4.贫困救助 5.商业医疗保险 6.全公费 7.全自费 8.其他社会保险 9.其他</Col
        >
      </Row>
      <Row>
        <Col span="22" push="2"
          >（二） 凡可由医院信息系统提供住院费用清单的，住院病案首页中可不填写“住院费用”。</Col
        >
      </Row>
      <!-- </Scroll> -->
    </div>
  </Drawer>
</template>
<script setup>
import { defineEmits } from 'vue'
const emit = defineEmits(['closeDrawer'])

import http from '@/util/http'
import { reactive } from 'vue'
import { gjInfoEnum, mzInfoEnum, kbInfoEnum } from './unils/infoEnum.js'
const diagItems = ref([
  {
    diid: '',
    listID: '',
    type: 1,
    way: 1,
    name: '',
    code: '',
    desc: '',
  },
  {
    diid: '',
    listID: '',
    type: 2,
    way: 1,
    name: '',
    code: '',
    desc: '',
  },
  {
    diid: '',
    listID: '',
    type: 2,
    way: 1,
    name: '',
    code: '',
    desc: '',
  },
  {
    diid: '',
    listID: '',
    type: 2,
    way: 1,
    name: '',
    code: '',
    desc: '',
  },
  {
    diid: '',
    listID: '',
    type: 2,
    way: 1,
    name: '',
    code: '',
    desc: '',
  },
  {
    diid: '',
    listID: '',
    type: 2,
    way: 1,
    name: '',
    code: '',
    desc: '',
  },
  {
    diid: '',
    listID: '',
    type: 2,
    way: 1,
    name: '',
    code: '',
    desc: '',
  },
  {
    diid: '',
    listID: '',
    type: 2,
    way: 1,
    name: '',
    code: '',
    desc: '',
  },
  {
    diid: '',
    listID: '',
    type: 2,
    way: 1,
    name: '',
    code: '',
    desc: '',
  },
  {
    diid: '',
    listID: '',
    type: 2,
    way: 1,
    name: '',
    code: '',
    desc: '',
  },
  {
    diid: '',
    listID: '',
    type: 2,
    way: 1,
    name: '',
    code: '',
    desc: '',
  },
  {
    diid: '',
    listID: '',
    type: 2,
    way: 1,
    name: '',
    code: '',
    desc: '',
  },
  {
    diid: '',
    listID: '',
    type: 2,
    way: 1,
    name: '',
    code: '',
    desc: '',
  },
  {
    diid: '',
    listID: '',
    type: 2,
    way: 1,
    name: '',
    code: '',
    desc: '',
  },
])

const groupedItems = computed(() => {
  const result = []
  for (let i = 0; i < diagItems.value.length; i += 2) {
    result.push([diagItems.value[i], diagItems.value[i + 1]])
  }
  console.log('分组', result)
  return result
})
const payEnum = {
  1: '按项目',
  2: '单病种',
  1: '按病种分值',
  2: 'DIP',
  1: '按床日',
  2: '按人头',
}

const sexEnum = {
  0: '未知的性别',
  1: '男',
  2: '女',
  9: '未说明的性别',
}

const certTypeEnum = {
  '01': '居民身份证',
  '02': '居民户口本',
  '03': '护照',
  '04': '军官证',
  '05': '驾驶证',
  '06': '港澳居民来往内地通行证',
  '07': '台湾居民来往内地通行证',
  '08': '母亲身份证',
  99: '其他法定有效证件',
}

const zyEnum = {
  11: '国家公务员',
  13: '专业技术人员',
  17: '职员',
  21: '企业管理人员',
  24: '工人',
  27: '农民',
  31: '学生',
  37: '现役军人',
  51: '自由职业者',
  54: '个体经营者',
  70: '无业人员',
  80: '退（离）休人员',
  90: '其他',
}

const gxEnum = {
  1: '本人',
  2: '户主',
  10: '配偶',
  11: '夫',
  12: '妻',
  20: '子',
  50: '父母',
  51: '父亲',
  52: '母亲',
}

const ybEnum = {
  1: '城镇职工基本医疗保险',
  2: '城镇居民基本医疗保险',
  3: '新型农村合作医疗',
  4: '贫困救助',
  5: '商业医疗保险',
  6: '全公费',
  7: '全自费',
  8: '其他社会保险',
  9: '其他',
  '01': '城镇职工基本医疗保险',
  '02': '城镇居民基本医疗保险',
  '03': '新型农村合作医疗',
  '04': '贫困救助',
  '05': '商业医疗保险',
  '06': '全公费',
  '07': '全自费',
  '08': '其他社会保险',
  '09': '其他',
  99: '其他',
}

const tsEnum = {
  1: '特困人员',
  2: '城乡低保对象',
  3: '农村建档立卡贫困人口',
  4: '贫困重度残疾人',
  9: '其他',
}
const xhEnum = {
  1: '正常新生儿',
  2: '早产儿',
  3: '有疾病新生儿',
  4: '非无菌分娩',
  9: '其他',
}

const Enum1 = {
  1: '住院',
  2: '日间手术',
}
const Enum2 = {
  1: '急诊',
  2: '门诊',
  3: '其他医疗机构转入',
  4: '其他',
  9: '其他',
}

const Enum3 = {
  1: '西医',
  2.1: '中医',
  2.2: '民族医',
  3: '中西医',
}
const Enum4 = {
  1: '医嘱离院',
  2: '医嘱转院，拟接收机构名称',
  3: '转医嘱转社区卫生服务机构/乡镇卫生院，拟接收机构名称',
  4: '非医嘱离院',
  5: '死亡',
  9: '其他',
}

const showLeft = ref(false)
const openLeft = (data) => {
  showLeft.value = true
  DetailInfo(data.listID)
}

const DetailInfo = (listID) => {
  http.get('/Settlement/List/Detail?listID=' + listID, {}, (response) => {
    console.log(response, 'response')
    form.head = response?.data?.data?.head
    form.basicInfo = response?.data?.data?.basicInfo
    form.chargeInfo = response?.data?.data?.chargeInfo
    form.diagInfo = response?.data?.data?.diagInfo
    form.personInfos = response?.data?.data?.personInfos

    form.personInfo = response?.data?.data?.personInfo

    diagItems.value =
      response?.data?.data?.diagInfo.diagItems.length > 0
        ? response?.data?.data?.diagInfo.diagItems.filter((item) => item.way == 1)
        : diagItems.value
    console.log(diagItems.value, 555)

    console.log(form.diagInfo, 12123)
  })
}
const mainDiagnosis = computed(() => diagItems.value.find((item) => item.type === 1) || {})

const otherLeft = computed(() => diagItems.value.filter((item) => item.type === 2).slice(0, 7))

const otherRight = computed(() => diagItems.value.filter((item) => item.type === 2).slice(7, 15))

const columns22 = [
  {
    title: '出院诊断',
    slot: 'redName',
    align: 'center',
  },
  {
    title: '疾病编码',
    slot: 'redCode',
    align: 'center',
  },
  { title: '入院病情', align: 'center', slot: 'redDesc' },
  { title: '出院诊断', align: 'center', slot: 'greenName' },
  { title: '疾病编码', align: 'center', slot: 'greenCode' },
  { title: '入院病情', align: 'center', slot: 'greenDesc' },
]

const closeLeft = () => {
  showLeft.value = false
  emit('closeDrawer')
}

let form = reactive({
  head: {
    qdlsh: '',
    hospitalName: '',
    hospitalCode: '',
    level: '',
    insureCode: '',
    number: '',
    declareTime: '',
  },
  basicInfo: { realName: '', sex: 0 },
  diagInfo: {
    way: '',
    operItems: [],
  },
  specialDiagInfos: [],
  chargeInfo: {},
  extra: {},
  personInfo: {},
})
let oper = reactive({ data: [] })

const route = useRoute()

let columns2 = [
  {
    title: '手术及操作编码',
    key: 'operCode',
    align: 'center',
    width: 100,
  },
  {
    title: '手术及操作日期',
    key: 'operTime',
    align: 'center',
    width: 100,
  },
  {
    title: '手术级别',
    key: 'level',
    align: 'center',
    width: 100,
  },
  {
    title: '手术及操作名称',
    key: 'operName',
    align: 'center',
    width: 200,
  },
  {
    title: '手术及操作医师',
    align: 'center',
    width: 200,
    children: [
      {
        title: '术者',
        key: 'sz',
        align: 'center',
        width: 100,
      },
      {
        title: 'Ⅰ助',
        key: 'yz',
        align: 'center',
        width: 100,
      },
      {
        title: 'Ⅱ助',
        key: 'ez',
        align: 'center',
        width: 100,
      },
    ],
  },
  {
    title: '切口愈合等级',
    key: 'cutLevel',
    align: 'center',
    width: 100,
  },
  {
    title: '麻醉方式',
    key: 'way',
    align: 'center',
    width: 100,
  },
  {
    title: '麻醉医师',
    key: 'anesDocName',
    align: 'center',
    width: 100,
  },
]
const ylfkfs = computed(() => {
  switch (form.basicInfo?.insureType) {
    case '01':
      return '城镇职工基本医疗保险'
    case '02':
      return '城镇居民基本医疗保险'
    case '03':
      return '新型农村合作医疗'
    case '04':
      return '贫困救助'
    case '05':
      return '商业医疗保险'
    case '06':
      return '全公费'
    case '07':
      return '全自费'
    case '90':
      return '城乡居民医疗保险'
    default:
      return '其他'
  }
})
const mz = computed(() => {
  switch (form.basicInfo?.nation) {
    case '01':
      return '汉族'
    case '02':
      return '蒙古族'
    case '03':
      return '回族'
    case '04':
      return '藏族'
    case '05':
      return '彝族'
    case '06':
      return '壮族'
    case '07':
      return '布依族'
    case '08':
      return '朝鲜族'
    default:
      return '汉族'
  }
})
const hy = computed(() => {
  switch (form.basicInfo?.hy) {
    case '10':
      return '未婚'
    case '20':
      return '已婚'
    case '21':
      return '初婚'
    case '22':
      return '再婚'
    case '23':
      return '复婚'
    case '30':
      return '丧偶'
    case '40':
      return '离婚'
    case '90':
      return '未说明的婚姻情况'
    default:
      return '未说明的婚姻情况'
  }
})
const zy = computed(() => {
  switch (form.basicInfo?.zy) {
    case '11':
      return '国家公务员'
    case '13':
      return '专业技术人员'
    case '17':
      return '职员'
    case '21':
      return '企业管理人员'
    case '24':
      return '工人'
    case '27':
      return '农民'
    case '31':
      return '学生'
    case '37':
      return '现役军人'
    case '51':
      return '自由职业者'
    case '54':
      return '个体经营者'
    case '70':
      return '无业人员'
    case '80':
      return '退（离）休人员'
    case '90':
      return '其他'
    default:
      return '其他'
  }
})
const gx = computed(() => {
  switch (form?.basicInfo?.gx) {
    case '01':
      return '本人'
    case '02':
      return '户主'
    case '10':
      return '配偶'
    case '11':
      return '夫'
    case '12':
      return '妻'
    case '20':
      return '子'
    case '31':
      return '学生'
    case '50':
      return '父母'
    case '51':
      return '父亲'
    case '52':
      return '母亲'
    default:
      return '其他'
  }
})
const rytj = computed(() => {
  switch (form?.basicInfo?.rytj) {
    case '1':
      return '门诊'
    case '2':
      return '急诊'
    case '3':
      return '其他医疗机构转入'
    case '9':
      return '其他'
    default:
      return '其他'
  }
})
const bloodType = computed(() => {
  switch (form?.diagInfo?.bloodType) {
    case '1':
      return 'A型'
    case '2':
      return 'B型'
    case '3':
      return 'O型'
    case '4':
      return 'AB型'
    case '5':
      return '不详'
    case '9':
      return '未查'
    default:
      return '未查'
  }
})
const rh = computed(() => {
  switch (form?.diagInfo?.rh) {
    case '1':
      return '阴性'
    case '2':
      return '阳性'
    case '3':
      return '不详'
    case '4':
      return '未查'
    default:
      return '未查'
  }
})
const outWay = computed(() => {
  switch (form?.diagInfo?.outWay) {
    case '1':
      return '医嘱离院'
    case '2':
      return '医嘱转院,拟接收医疗机构名称：' + form.diagInfo.outWay_Dept
    default:
      return '未查'
  }
})
const outAgainType = computed(() => {
  switch (form?.diagInfo?.outAgainType) {
    case '1':
      return '无'
    case '2':
      return '有，目的' + form.diagInfo.outAgainType_Memo
    default:
      return '未查'
  }
})
const bazl = computed(() => {
  switch (form?.personInfo?.bazl) {
    case '1':
      return '甲'
    case '2':
      return '乙'
    case '3':
      return '丙'
    default:
      return '未查'
  }
})
defineExpose({
  openLeft,
  showLeft,
})
</script>
<style scoped>
.hx {
  border-bottom: 1.5px solid;
  padding-left: 2px;
  text-align: center;
  /* font-weight: bold; */
  /* font-family: '宋体'; */
  /* font-size: 16px; */
  /* color: black; */
}

.ivu-row {
  padding-top: 10px;
}

.underline {
  text-decoration: underline;
  text-underline-offset: 0.5em;
}
</style>
